<%--
    Document   : change_query
    Created on : 2010-5-8, 17:32:29
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*,java.util.*"  %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="modify" scope="session" class="dataconn.MyDbBean"/>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>修改记录</title>
    </head>
    <body>
        <%!	String xuehao,name,sex,age,jiguan,department,url,sql; %>
        <%! int i;%>       
        <%
            xuehao=request.getParameter("xuehao").trim();
            out.print(xuehao);
            name=request.getParameter("name").trim();
            name=new String(name.getBytes("ISO-8859-1"),"UTF-8");
            sex=request.getParameter("sex").trim();
            sex=new String(sex.getBytes("ISO-8859-1"),"UTF-8");
            age=request.getParameter("age").trim();
            i=Integer.parseInt(age);
            jiguan=request.getParameter("jiguan").trim();
            jiguan=new String(jiguan.getBytes("ISO-8859-1"),"UTF-8");
            department=request.getParameter("department").trim();
            department=new String(department.getBytes("ISO-8859-1"),"UTF-8");
            if(name.equals(""))
            {
                response.sendRedirect("err1.jsp");
            }
            try
            {
                //调用getConn()方法与数据库建立连接
                modify.getConn("Data_Stu","sa","");
                sql="update stuInfo set 姓名= '"+name+"',性别= '"+sex+"',年龄="+i+",籍贯= '"+jiguan+"',院系= '"+department+"' where 学号= '"+xuehao+"'";
                modify.executeUpdate2(sql);
                out.println("<font size=3 color=blue>正在修改记录，请稍后......</font><meta http-equiv='refresh' content='2;url=list.jsp'>");
                modify.closeStmt();
                modify.closeConn();
            }
            catch(Exception e)
            {
                response.sendRedirect("err.jsp");
            }
        %>
        </body>
</html>